package com.adds.lvds.security.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.adds.lvds.core.plugin.PageView;
import com.adds.lvds.security.dao.SysUserLogMapper;
import com.adds.lvds.security.model.SysUserLog;

@Transactional
@Service("sysUserLogService")
public class SysUserLogService{
	@Autowired
	private SysUserLogMapper userLoginMap;
    /**
     * 分页显示
     * @param pageView
     * @param userLogin
     * @return
     */
	public PageView<SysUserLog> query(PageView<SysUserLog> pageView, SysUserLog userLogin) {
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			map.put("paging", pageView);
			map.put("t", userLogin);
			List<SysUserLog> list = userLoginMap.pageSysUserLogByCondition(map);
			pageView.setRecords(list);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
		return pageView;
	}
	/**
	 * 录入用户登录日志
	 * @param t
	 * @throws Exception
	 */
	public void addSysUserLog(SysUserLog t){
		try {
			userLoginMap.addSysUserLog(t);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}  
}
